<template>
	<view class="profile1">
		<image class="mybackimg" src="http://assessgeek.oss-cn-hangzhou.aliyuncs.com/upload/20200722/0ada6808ebb97bd02beb1efa328597e7e135d1ff.png" mode="scaleToFill" style="width: 750rpx; height: 523rpx;"></image>
		<text class="my">我的</text>
		<view class="personal">
			<image :src="avatar_url" mode="scaleToFill" style="width: 100rpx; height: 100rpx;"></image>
			<text>{{nick_name}}</text>
		</view>
		<view class="list">
			<view v-for="(item,index) in list" :key="item.id" @click="jump(index)">
				<text>{{item}}</text>
				<text v-if="index == 1 && server  ==0" class="clsTxt wei">未添加</text>
				<text class="iconfont icon-jiantou clsTxt"></text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onShow() {
			let i = this.$store.state.userinfo;
			console.log(i);
			this.getContact();
			this.getxinxi();
		},
		onLoad() {},
		data() {
			return {
				actives: '1',
				path1: "../../homePage3/homePage3",
				backgroundColor: "transparent",
				list: ["我的诊所", "客服管理", "诊所二维码"],
				path: null,
				avatar_url: null,
				nick_name: null,

				// 客服
				serverName: null,
				serverTel: null,
				server: 1,
			};
		},
		methods: {
			jump(index) {
				switch (index) {
					case 0:
						this.path = "../../operation4/setUp1/setUp1";
						break;
					case 1:
						this.path = `../customerService2/customerService2?serverName=${this.serverName}&serverTel=${this.serverTel}`;
						break;
					case 2:
						this.path = "../../doctors5/invitation3/invitation3";
						break;
				};
				uni.navigateTo({
					url: this.path
				});
			},
			async getxinxi() {
				let openid = this.$store.state.openid;
				let res = await this.$myrequest({
					url: `Service/getUers?openid=${openid}`,
				});
				this.nick_name = res.data.data.nick_name;
				this.avatar_url = res.data.data.avatar_url;
			},
			async getContact() {
				let id = this.$store.state.userinfo.id;
				let res = await this.$myrequest({
					url: `Service/getContact?id=${id}`,
				});
				if (res.data.data.contact_name == "" || res.data.data.contact_name == null) {
					this.server = 0;
				} else {
					this.server = 1;
				};
			},
		}
	}
</script>

<style lang="scss">
	page {
		padding: 0;
		margin: 0;
		width: 100%;
		height: 100%;
		background-color: #F5F8FA;
	}

	.profile1 {
		width: 100%;
		height: 100%;
		background-color: #F5F8FA;
	}

	.personal {
		position: absolute;
		z-index: 50;
		top: 200rpx;
		left: 30rpx;
		display: flex;
		align-items: center;

		image {
			width: 100rpx;
			height: 100rpx;
			border-radius: 50rpx;
		}

		text {
			margin-left: 30rpx;
			color: #FFFFFF;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
		}
	}

	.list {
		@include shuiping;
		background-color: #FFFFFF;
		box-sizing: border-box;
		width: 689rpx;
		height: 300rpx;
		padding: 20rpx 40rpx;
		border-radius: 10rpx;
		overflow: hidden;
		top: 375rpx;
		display: flex;
		flex-wrap: wrap;
		z-index: 100;

		view {
			width: 100%;
			@include chuizhilianduan;
			font-size: 30rpx;
			border-bottom: 2rpx solid transparent;

			&:not(:last-of-type) {
				border-bottom: 2rpx solid RGBA(234, 234, 235, 1);
			}
		}
	}

	.clsTxt {
		color: #999999;
		font-size: 24rpx;
	}

	.wei {
		display: inline-block;
		width: 400rpx;
		text-align: right;
	}
</style>
